﻿#ifndef MAIN_H
#define MAIN_H

#include <QImage>
#include <QDesktopWidget>
#include "settings/settings.h"
#include "machine/machine.h"
#include "machine/lotmachine.h"
#include "datafile/embdata.h"

#define NAMEMAXLENGTH    8                      // 字体最大长度
#define LINUXUSBPATH     "/media/usb0/"
#define PATTERNPATH      "datafiles"
#define IMAGE_TYPE       (QImage::Format_ARGB32)
#define PEN_WIDTH        1

#define LINUX_APPNAME "OPRT_CP"
#define WIN_APPNAME   "oprt_up.exe"
#define APPNAME       "XPLATFORM"
#define PASSWORD_ONE  "290810"        //一级密码
#define PASSWORD_TWO  "262574"        //二级密码
#define PASSWORD_RESETPARA  "123456"        //重置参数密码
#define FONTSIZE  10        //默认字体大小

#define HMI_UPDATA          1   // 界面升级
#define MC_UPDATA           2   // 主控升级
#define PARA_IMPORT         3   // 参数导入
#define PARA_EXPORT         4   // 参数导出
#define PRODUCTSTATIS       5   // 生产统计
#define JOURNAL             6   // 日志文件
#define BACKUPS_UPDATA      7   // 界面还原

#define UNITDEC 0

enum ConnectState
{
    NoConnect = 1, //未连接
    Connectting = 2, //连接中
    Connected = 3 //已连接
};

//用户权限
enum UserRoles
{
    operate = 0,
    repair  = 1,
    root  = 2,
    resetpara = 3
};

//分辨率
enum Resolution
{
    resolution1910 = 0, // 1920x1080(15寸)
    resolution1006 = 1, // 1024x600 (10寸)
    resolution0804 = 2  // 800x480  (7寸)
};

//主题
enum Theme
{
    theme1 = 1,         // 主题1
    theme2 = 2,         // 主题2
    theme3 = 3          // 主题3
};

//语言
enum Language
{
    chinese = 0,        // 中文
    english = 1 ,       // 英文
    spanish = 2,        // 西班牙文
    bengal = 3,         // 孟加拉文
    turkey = 4,         // 土耳其文
    denmark =5
};

enum DebugMode
{
    debugMode = 0,      // 是调试模式
    nodebugMode = 1     // 不是调试模式
};

//机器类型
enum MachineType
{
    MACHINE_HIGHSPEEDSINGLEQUI = 0,          //高速单针绗缝机
    MACHINE_FIVEHEADPRECISIONSEWING = 1,           //五头精密缝
    MACHINE_CLOTHINGMAC = 2,                            //服装机
    MACHINE_MULTINEEDLEROTARY = 3,          //多针旋梭
    MACHINE_FLATCUTTINGMAC = 4,          //平板切割机
    MACHINE_THICK_WIRING = 5,          //粗线布线机
    MACHINE_FLYFLATCUTTING = 6,         //飞行切割平板切割机
    MACHINE_DRAWING = 7,         //画线机
};

//产品类型
enum ProductType
{
     PRODUCT_NULL //无产品类型
};

#ifdef _IN_MAIN_CPP

LotMachine * g_pLotMachine;//物联网Machine,作为客户端发送数据给mqtt网关
Machine * g_pMachine;
EmbData * g_pCurEmbData = NULL;
UserRoles g_emUser = operate;
QString g_passwordOne = PASSWORD_ONE;
Settings * g_pSettings = NULL;
Resolution g_emResolut = resolution1910;
Theme g_emTheme = theme1;
int g_fontsize;//字体大小
MachineType g_emMacType = MACHINE_HIGHSPEEDSINGLEQUI;
ProductType g_emProductType = PRODUCT_NULL;
DebugMode g_emDebugMode = nodebugMode;
QPoint g_mainWidgetPos;

////平板飞行切割机
//int DATA_FORMATE;
#else

//平板飞行切割机
//extern int DATA_FORMATE;

extern Machine * g_pMachine;
extern LotMachine * g_pLotMachine;//物联网Machine,作为客户端发送数据给mqtt网关
extern EmbData * g_pCurEmbData;//绣花数据(库)
extern UserRoles g_emUser;
extern QString g_passwordOne;//一级密码
extern Settings * g_pSettings;
extern Resolution g_emResolut;
extern Theme g_emTheme;
extern int g_fontsize;//字体大小
extern MachineType g_emMacType;
extern ProductType g_emProductType;
extern DebugMode g_emDebugMode;
extern QPoint g_mainWidgetPos;
#endif


#endif // MAIN_H
